package group_1.MultiSnake;



import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;


public class MainActivity extends Activity implements OnClickListener{
	private Button playGameBtn;
	private Button gameStatsBtn;
	private Button settingsBtn;
	private Button aboutBtn;
	private Button exitBtn;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        findViews();
        setListeners();
    }
    
   /* @Override
    public boolean onCreateOptionsMenu(Menu menu) {
	    super.onCreateOptionsMenu(menu);
	    MenuInflater inflater = getMenuInflater();
	    inflater.inflate(R.menu.menu, menu);
	    return true;
    }
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
	    switch (item.getItemId()) {
		    case R.id.settings:
		    startActivity(new Intent(this, Prefs.class));
		    return true;
		    // More items go here (if any) ..
	    }
	    return false;
    }*/
    
    private void findViews() {
    	playGameBtn = (Button)findViewById(R.id.play_game_btn);
    	gameStatsBtn = (Button)findViewById(R.id.game_stats_btn);
    	settingsBtn = (Button)findViewById(R.id.settings_btn);
    	aboutBtn = (Button)findViewById(R.id.about_btn);
    	exitBtn = (Button)findViewById(R.id.exit_button);
    }
    
    private void setListeners() {
    	playGameBtn.setOnClickListener(this);
    	gameStatsBtn.setOnClickListener(this);
    	settingsBtn.setOnClickListener(this);
    	aboutBtn.setOnClickListener(this);
    	exitBtn.setOnClickListener(this);
    }

	@Override
	public void onClick(View v) {
		switch(v.getId()) {
		case R.id.play_game_btn:
			//newGame();
			startActivity(new Intent(this, PlayGame.class));
			break;
		case R.id.about_btn:
			Intent i = new Intent(this, About.class);
			startActivity(i);
			break;
		case R.id.settings_btn:
		    startActivity(new Intent(this, Prefs.class));
			break;
		case R.id.game_stats_btn:
			startActivity(new Intent(this, GameStats.class));
			break;
		case R.id.exit_button:
			this.finish();
			break;
		}
	}
}